'use strict';
angular.module('ngCocStorage', [])
        .factory('$localStorage', function() {
            var $storage = {
                isSuported: function() {
                    if (typeof (localStorage) == 'undefined') {
                        alert('Atualize o seu navegador');
                        return;
                    }
                },
                set: function(key, value) {
                    this.isSuported();
                    localStorage.setItem(key, value);
                },
                get: function(key) {
                    this.isSuported();
                    return localStorage.getItem(key) || false;
                },
                delete: function() {
                    this.isSuported();
                    return localStorage.removeItem(key);
                },
                reset: function() {
                    this.isSuported();
                    localStorage.clear();
                }


            };

            return $storage;
        });


